from django.conf.urls import url
from rest_framework.routers import DefaultRouter

from apps.meiduo_admin.views import users, shop, sku, orders, admin
from rest_framework_jwt.views import obtain_jwt_token

urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    url(r'^statistical/total_count/$', users.UserAllView.as_view()),
    url(r'^statistical/day_increment/$', users.UserTodayView.as_view()),
    url(r'^statistical/day_active/$', users.UserLasttimeView.as_view()),
    url(r'^statistical/day_orders/$', users.UserOrderView.as_view()),
    url(r'^statistical/month_increment/$', users.UserMonthView.as_view()),
    url(r'^statistical/goods_day_views/$', users.GoodVisitView.as_view()),
    url(r'^users/$', users.UsersView.as_view()),
    url(r'^goods/simple/$', shop.SpecView.as_view({'get': 'simple'})),
    url(r'^skus/simple/$', shop.ImageView.as_view({'get': 'simple'})),
    url(r'^goods/(?P<pk>\d+)/specs/$', sku.SKUGoodsView.as_view({'get': 'specs'})),
    url(r'^permission/content_types/$', admin.PermissionView.as_view({'get': 'content_type'})),
    url(r'^permission/simple/$', admin.GroupView.as_view({'get': 'simple'})),
    url(r'^permission/groups/simple/$', admin.AdminView.as_view({'get': 'simple'})),
    url(r'^goods/brands/simple/$', sku.SPUView.as_view({'get': 'simple'})),
    url(r'^goods/images/$', sku.SPUView.as_view({'post': 'images'})),
    url(r'^goods/channel/categories/$', sku.SPUView.as_view({'get': 'get_categories'})),
    url(r'^goods/channel/categories/(?P<pk>\d+)/$', sku.SPUView.as_view({'get': 'get_categories_id'})),
    url(r'^goods/specs/simple/$', sku.SpecsView.as_view({'get': 'simple'})),
    url(r'^goods/channel_types/$', sku.ChannelsView.as_view({'get': 'channel_types'})),
    url(r'^goods/categories/$', sku.ChannelsView.as_view({'get': 'categories'})),
    # url(r'^goods/brands/(?P<pk>\d+)/$', sku.BrandsView.as_view({'get': 'categories'})),
]
# Channels
router = DefaultRouter()
router.register('goods/channels', sku.ChannelsView, base_name='channels')
urlpatterns += router.urls
# Brands
router = DefaultRouter()
router.register('goods/brands', sku.BrandsView, base_name='brands')
urlpatterns += router.urls
# 商品规格
router = DefaultRouter()
router.register('goods/specs', shop.SpecView, base_name='specs')
urlpatterns += router.urls
# 商品图片
router = DefaultRouter()
router.register('skus/images', shop.ImageView, base_name='image')
urlpatterns += router.urls
# SKU
router = DefaultRouter()
router.register('skus', sku.SKUGoodsView, base_name='skus')
urlpatterns += router.urls
# Orders
router = DefaultRouter()
router.register('orders', orders.OrdersView, base_name='orders')
urlpatterns += router.urls
# permission
router = DefaultRouter()
router.register('permission/perms', admin.PermissionView, base_name='perssion')
urlpatterns += router.urls
# Group
router = DefaultRouter()
router.register('permission/groups', admin.GroupView, base_name='groups')
urlpatterns += router.urls
# admin
router = DefaultRouter()
router.register('permission/admins', admin.AdminView, base_name='admins')
urlpatterns += router.urls
# SPU
router = DefaultRouter()
router.register('goods', sku.SPUView, base_name='SPU')
urlpatterns += router.urls
# router = DefaultRouter()
# router.register('goods/images', sku.SPUView, base_name='SPUImage')
# urlpatterns += router.urls
# SPU
router = DefaultRouter()
router.register('specs/options', sku.SpecsView, base_name='spec')
urlpatterns += router.urls

